{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入圆的半径：4\n",
      "d=25.13\n",
      "s=50.27\n"
     ]
    }
   ],
   "source": [
    "pi = 3.14159\n",
    "r = eval(input('输入圆的半径：'))\n",
    "d = 2 * pi * r\n",
    "s = pi * r * r\n",
    "print('d={:.2f}'.format(d))\n",
    "print('s={:.2f}'.format(s))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入两个数：4,5\n",
      "a小于b\n"
     ]
    }
   ],
   "source": [
    "a, b = eval(input('输入两个数：'))\n",
    "if  a >= b:\t\t\t\t# 按语法要求，此处必须有冒号\n",
    "\tprint('a大于等于b')\t\t# 下级语句块要缩进\n",
    "else:\t\t\t\t\t# else处也有冒号，不能缩进，要和if对齐\n",
    "\tprint('a小于b')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入一个整数：44\n",
      "输入的是小于100的偶数\n"
     ]
    }
   ],
   "source": [
    "x = eval(input('输入一个整数：'))\n",
    "if  (x % 2 == 0) and (0 < x < 100):\n",
    "\tprint('输入的是小于100的偶数')\n",
    "else:\n",
    "\tprint('输入的是其他数')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Input an integer:7896\n",
      "m = 896\n"
     ]
    }
   ],
   "source": [
    "m = eval(input(\"Input an integer:\"))\n",
    "if  m >= 10000:\n",
    "\tm = m % 10000\n",
    "elif m >= 1000:\n",
    "\tm = m % 1000\n",
    "elif m >= 100:\n",
    "\tm = m % 100\n",
    "else:\n",
    "\tm = m % 10\n",
    "print('m =', m)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Input an integer:7896\n",
      "896\n"
     ]
    }
   ],
   "source": [
    "m = input(\"Input an integer:\")\n",
    "print(m[1:])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
